package com.lee.limiter.maplimit;

/**
 * User:liwei
 * Date:2017/9/1
 * Time:15:08
 */
public class TokenBucket {
    //上次填入的时间
    private long lastRefillTime;

    //当前存活的token数量
    private long tokensRemaining;

    public TokenBucket(long tokensRemaining, long lastRefillTime) {
        this.tokensRemaining = tokensRemaining;
        this.lastRefillTime = lastRefillTime;
    }

    public long getLastRefillTime() {
        return lastRefillTime;
    }

    public long getTokensRemaining() {
        return tokensRemaining;
    }

    public void setTokensRemaining(long tokensRemaining) {
        this.tokensRemaining = tokensRemaining;
    }

    public void setLastRefillTime(long lastRefillTime) {
        this.lastRefillTime = lastRefillTime;
    }

    @Override
    public String toString() {
        return "TokenBucket{" +
                "lastRefillTime=" + lastRefillTime +
                ", tokensRemaining=" + tokensRemaining +
                '}';
    }
}
